﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;

public class UIEventTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler, IInitializePotentialDragHandler, IBeginDragHandler, IDragHandler, IEndDragHandler
{
    public class Event<T> : UnityEvent<T> { }
    protected Event<PointerEventData> _onPointerDown, _onPointerEnter, _onPointerExit, _onPointerUp, _onPointerClick;
    protected Event<PointerEventData> _onBeginDrag, _onDrag, _onEndDrag, _onInitializePotentialDrag;
    public Event<PointerEventData> onPointerDown
    {
        get
        {
            if (_onPointerDown == null) _onPointerDown = new Event<PointerEventData>();
            return _onPointerDown;
        }
    }
    public Event<PointerEventData> onPointerUp
    {
        get
        {
            if (_onPointerUp == null) _onPointerUp = new Event<PointerEventData>();
            return _onPointerUp;
        }
    }
    public Event<PointerEventData> onPointerEnter
    {
        get
        {
            if (_onPointerEnter == null) _onPointerEnter = new Event<PointerEventData>();
            return _onPointerEnter;
        }
    }
    public Event<PointerEventData> onPointerExit
    {
        get
        {
            if (_onPointerExit == null) _onPointerExit = new Event<PointerEventData>();
            return _onPointerExit;
        }
    }
    public Event<PointerEventData> onPointerClick
    {
        get
        {
            if (_onPointerClick == null) _onPointerClick = new Event<PointerEventData>();
            return _onPointerClick;
        }
    }
    public void OnBeginDrag(PointerEventData eventData)
    {
        throw new NotImplementedException();
    }
    public void OnDrag(PointerEventData eventData)
    {
        throw new NotImplementedException();
    }
    public void OnEndDrag(PointerEventData eventData)
    {
        throw new NotImplementedException();
    }
    public void OnInitializePotentialDrag(PointerEventData eventData)
    {
        throw new NotImplementedException();
    }
    public void OnPointerClick(PointerEventData eventData)
    {
        throw new NotImplementedException();
    }
    public void OnPointerDown(PointerEventData eventData)
    {
        onPointerDown.Invoke(eventData);
    }
    public void OnPointerEnter(PointerEventData eventData)
    {
        onPointerEnter.Invoke(eventData);
    }
    public void OnPointerExit(PointerEventData eventData)
    {
        onPointerExit.Invoke(eventData);
    }
    public void OnPointerUp(PointerEventData eventData)
    {
        onPointerUp.Invoke(eventData);
    }
}